clear all

** set working directory **

use "study 1.dta"

*demographics
recode sex 2/3=0, gen(male)
recode pid 1=2 2=6 3/4=4, gen(PID)
recode PID 2=1 if dem==1
recode PID 6=7 if rep==1
recode PID 4=3 if ind==1
recode PID 4=5 if ind==2

*scoring all items so higher value = more sexist
recode asi_m4 1=5 2=4 4=2 5=1
foreach var of varlist asi_o* {
recode `var' 1=6 2=5 3=4 4=3 5=2 6=1
}

*creating sum scores, calculating reliability
alpha asi_m*, item casewise asis gen(ASIavg_m)
alpha asi_o*, item casewise asis gen(ASIavg_o)

*self-report
recode self_credit 2=0
recode self_leash 2=0
recode self_offend 3=1 4=0
recode self_power 2=0
recode self_problems 2=0
egen fullself=rowfirst(self_credit self_leash self_offend self_power self_problems)

*keeping only those who completed both scales
keep if ASIavg_m!=. & ASIavg_o!=.

*rescaling to 01
gen ASIm01=(ASIavg_m - 1)/4
gen ASIo01=(ASIavg_o - 1)/5


************
* analysis *
************

*reliability
alpha asi_m*, item casewise asis 
alpha asi_o*, item casewise asis 

*time on each scale
sum t_asi_m_Page, detail
sum t_asi_o_Page, detail

*Figure 1
hist ASIm01, freq xlab(0(.2)1) ylab(0(20)100) xtitle("Item-Specific Scale") saving(hist_m.gph, replace)
hist ASIo01, freq xlab(0(.2)1) ylab(0(20)100) xtitle("Agree-Disagree Scale") saving(hist_o.gph, replace)
twoway lfit ASIm01 ASIo01, legend(off) || scatter ASIm01 ASIo01, jitter(3) mcol(red%40) ///
	ytitle("Item-Specific Scale") xtitle("Agree-Disagree Scale") saving(scatter.gph, replace)
graph combine hist_o.gph hist_m.gph scatter.gph, subtitle("")

*ceiling and floor effects
tab ASIavg_o
tab ASIavg_m
sum ASIavg_o if ASIavg_m==1
sum ASIavg_m if ASIavg_o==1
sum ASIm01 if ASIavg_o==1

*correlation between scales
corr ASIavg_o ASIavg_m

*self-reported preferences
prop fullself
